mod parse_fun;

#[cfg(test)]
mod tests {
    use super::parse_fun::parse_percentage;
    
    const TEST_CASE: &[(&str, &str)] = &[
        ("50", "50"),
        ("101", "Percentage out of range"),
        ("abc", "Invalid input"),
    ];

    #[test]
    fn test_case() {
        for (input: &&str, expected: &Result<u8, String>) in TEST_CASE {
            let start = Instant::now();
            let result = parse_percentage(*input);
            let duration = start.elapsed();

            if result == *expected {
                println!("passed. used {} ms", duration);
            } else {
                println!("failed.")
            }
        }
    }
}
